package com.xxx.mch.domain.dto;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @date 2020/9/11
 */
@Data
public class UserData
{
    private String uid;

    private List<String> permissonCodeList = new ArrayList<>();

    /**
     * 1：主要领导(可以查看所有部门及员工)；2：部门领导(可以查看部门员工信息)；3：普通员工
     */
    private Integer role;

    public Integer getRole()
    {
        if (permissonCodeList.contains("KPI_DEFAULT_kh_pd_committeeM")
                || permissonCodeList.contains("KPI_DEFAULT_kh_pd_masterhrm")
                || permissonCodeList.contains("KPI_DEFAULT_kh_pd_dutyM")
                || permissonCodeList.contains("KPI_DEFAULT_kh_pd_hrM"))
        {
            return 1;
        }
        else if (permissonCodeList.contains("KPI_DEFAULT_kh_pd_chiefdepartM")
                || permissonCodeList.contains("KPI_DEFAULT_kh_pd_deputydepartM"))
        {
            return 2;
        }
        return 3;
    }
}
